import request from '@/utils/request'

export function getTree() {
  return request({
    url: 'dept/tree',
    method: 'get'
  })
}

export function getAllTree() {
  return request({
    url: 'dept/bigTree',
    method: 'get'
  })
}

export function getTotalTree() {
  return request({
    url: 'dept/totalTree',
    method: 'get'
  })
}

export function queryPage(query) {
  return request({
    url: 'dept/page',
    method: 'post',
    params: {
      id: query.orgId,
      deptName: query.deptName,
      current: query.page,
      size: query.size
    }
  })
}

export function create(temp) {
  return request({
    url: 'dept/add',
    method: 'post',
    data: temp
  })
}

export function update(temp) {
  return request({
    url: 'dept/update',
    method: 'post',
    data: temp
  })
}

export function deleteById(id) {
  return request({
    url: 'dept/' + id,
    method: 'delete'
  })
}

export function queryInfo(id) {
  return request({
    url: 'dept/detail/' + id,
    method: 'get'
  })
}
